bitkeeper revision 1.1230.4.1 (421b7d70g_kPPMvAgkUMMU-R8G4RrA)
authorrneugeba@wyvis.research.intel-research.net <rneugeba@wyvis.research.intel-research.net>
Tue, 22 Feb 2005 18:44:00 +0000 (18:44 +0000)
committerrneugeba@wyvis.research.intel-research.net <rneugeba@wyvis.research.intel-research.net>
Tue, 22 Feb 2005 18:44:00 +0000 (18:44 +0000)
add perfcounters for pagetable update histograms

Signed-off-by: michael.fetterman@cl.cam.ac.uk
xen/arch/x86/mm.c
xen/common/perfc.c
xen/include/xen/perfc_defn.h

index 25099101173f984a4ddc5b29dad3a8092d860a61..e966d60e8be435004e2b445b977f4260c1efe613 100644 (file)
@@ -1686,8 +1686,30 @@ int do_mmu_update(
         }
     }
 
+#ifdef PERF_COUNTERS
     perfc_incrc(calls_to_mmu_update); 
     perfc_addc(num_page_updates, count);
+    /*
+     * do a histogram for count. 
+     * first bucket is for count=0,
+     * second bucket is for count=1
+     * last bucket is for count >= 63 *  PERFC_PT_UPDATES_BUCKET_SIZE
+     */
+    if ( count == 0 )
+    {
+        perfc_incra(bpt_updates, 0);
+    } else if ( count == 1 )
+    {
+        perfc_incra(bpt_updates, 1);
+    } else if ( (count / PERFC_PT_UPDATES_BUCKET_SIZE)
+                < (PERFC_MAX_PT_UPDATES - 3) )
+    {
+        perfc_incra(bpt_updates, (count / PERFC_PT_UPDATES_BUCKET_SIZE) + 2);
+    } else
+    {
+        perfc_incra(bpt_updates, PERFC_MAX_PT_UPDATES - 1);
+    }
+#endif
 
     if ( unlikely(!array_access_ok(VERIFY_READ, ureqs, count, sizeof(req))) )
     {
@@ -2232,6 +2254,7 @@ void ptwr_flush(const int which)
     int            i, cpu = smp_processor_id();
     struct exec_domain *ed = current;
     struct domain *d = ed->domain;
+    unsigned int   count;
 
     l1va = ptwr_info[cpu].ptinfo[which].l1va;
     ptep = (unsigned long *)&linear_pg_table[l1_linear_offset(l1va)];
@@ -2290,7 +2313,7 @@ void ptwr_flush(const int which)
     /*
      * STEP 2. Validate any modified PTEs.
      */
-
+    count = 0;
     pl1e = ptwr_info[cpu].ptinfo[which].pl1e;
     for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
     {
@@ -2300,6 +2323,9 @@ void ptwr_flush(const int which)
         if ( likely(l1_pgentry_val(ol1e) == l1_pgentry_val(nl1e)) )
             continue;
 
+        /* update number of entries modified */
+        count++;
+
         /*
          * Fast path for PTEs that have merely been write-protected
          * (e.g., during a Unix fork()). A strict reduction in privilege.
@@ -2341,6 +2367,30 @@ void ptwr_flush(const int which)
     }
     unmap_domain_mem(pl1e);
 
+#ifdef PERF_COUNTERS
+    /*
+     * do a histogram for count. 
+     * first bucket is for count=0,
+     * second bucket is for count=1
+     * last bucket is for count >= 63 *  PERFC_PT_UPDATES_BUCKET_SIZE
+     */
+    if ( count == 0 )
+    {
+        perfc_incra(wpt_updates, 0);
+    } else if ( count == 1 ) 
+    {
+        perfc_incra(wpt_updates, 1);
+    } else if ( (count / PERFC_PT_UPDATES_BUCKET_SIZE)
+                < (PERFC_MAX_PT_UPDATES - 3) )
+    {
+        perfc_incra(wpt_updates, (count / PERFC_PT_UPDATES_BUCKET_SIZE) + 2);
+    } else
+    {
+        perfc_incra(wpt_updates, PERFC_MAX_PT_UPDATES - 1);
+    }
+#endif
+    
+
     /*
      * STEP 3. Reattach the L1 p.t. page into the current address space.
      */
index 511df11a9e0f5ce44cee44fa753cd0840c905665..4a5c1708506f7c20a62244d8765408cbd35dfd04 100644 (file)
@@ -66,9 +66,13 @@ void perfc_printall(unsigned char key)
         case TYPE_S_ARRAY:
             for ( j = sum = 0; j < perfc_info[i].nr_elements; j++ )
                 sum += atomic_read(&counters[j]);
-            printk("TOTAL[%10d]  ", sum);
+            printk("TOTAL[%10d]\n ", sum);
             for ( j = 0; j < perfc_info[i].nr_elements; j++ )
-                printk("ARR%02d[%10d]  ", j, atomic_read(&counters[j]));
+            {
+                printk("A%02d[%10d]  ", j, atomic_read(&counters[j]));
+                if ( !(j % 4) )
+                    printk("\n ");
+            }
             counters += j;
             break;
         }
index af13e7121183b9e2e7f75f03755c4dfd45997680..18db383a2c6997bdcc97deaf658c02ab850edf1b 100644 (file)
@@ -35,7 +35,14 @@ PERFSTATUS( shadow_l1_pages, "current # shadow L1 pages" )
 PERFCOUNTER_CPU( check_pagetable, "calls to check_pagetable" )
 PERFCOUNTER_CPU( check_all_pagetables, "calls to check_all_pagetables" )
 
+/* XXX constant from dom0_ops.h */
+#define PERFC_MAX_PT_UPDATES 64
+#define PERFC_PT_UPDATES_BUCKET_SIZE 3
+PERFCOUNTER_ARRAY( wpt_updates, "writable pt updates", PERFC_MAX_PT_UPDATES )
+PERFCOUNTER_ARRAY( bpt_updates, "batched pt updates", PERFC_MAX_PT_UPDATES )
+
+
 #define VMX_PERF_EXIT_REASON_SIZE 37
 #define VMX_PERF_VECTOR_SIZE 0x20
-PERFCOUNTER_ARRAY(vmexits, "vmexits", VMX_PERF_EXIT_REASON_SIZE )
-PERFCOUNTER_ARRAY(cause_vector, "cause vector", VMX_PERF_VECTOR_SIZE )
+PERFCOUNTER_ARRAY( vmexits, "vmexits", VMX_PERF_EXIT_REASON_SIZE )
+PERFCOUNTER_ARRAY( cause_vector, "cause vector", VMX_PERF_VECTOR_SIZE )